<?php
@session_start();
$iduser 	= $_GET['id'];
$sqluser 	= mysql_query("SELECT * FROM admin_usuarios WHERE id = '$iduser'");
$row 		= mysql_fetch_array($sqluser);

$sqlmenu 	= mysql_query("SELECT * FROM menu");

function checked($session,$iduser){
	$sql = mysql_query("SELECT * FROM sessao WHERE id_sessao = '$session' AND id_user = '$iduser'");
	if(mysql_num_rows($sql)>0){
		return "checked";
		}else{
		return "";
		}
	
	}


if($_POST){
?>
<div class="alertErro">
Dados alterados com sucesso!
</div>
<?	
}

?>
<link href="../../css/style.css" rel="stylesheet" type="text/css">

<form action="modulos/dados/altera.php" method="post" enctype="multipart/form-data">
<input type="hidden" name="iduser" value="<?=$row['id']?>" />
<div id="lista">
<h3>Dados de <?=$row['nome']?></h3>

<span class="textonormal">Nome:</span><br />
<input name="nome" type="text" class="text-input medium-input datepicker" id="nome" value="<?=$row['nome']?>">
<br>
<br>
<span class="textonormal">E-mail:</span><br />
<input name="email" type="text" class="text-input medium-input datepicker" id="email" value="<?=$row['email']?>">
<br>
<br>
<span class="textonormal">Usuario:</span><br />
<input type="text" disabled="disabled" class="text-input small-input" value="<?=$row['usuario']?>">
<br>
<br />
<fieldset>
<legend class="titulopaginas">&nbsp;&nbsp;Modulos&nbsp;&nbsp;</legend>
<?php while($rowm = mysql_fetch_array($sqlmenu)){
		?>
<div style="float:left; width:200px; margin-bottom:5px"><input type="checkbox" name="menus[]" value="<?=$rowm['id']?>" <?=checked($rowm['id'],$iduser)?>  /><?=$rowm['menu']?></div>
<? } ?>
</fieldset>

<br>



<div class="notification attention png_bg">
				<a href="#" class="close"><img src="resources/images/icons/cross_grey_small.png" title="Close this notification" alt="close" /></a>
				<div>
Caso queira alterar a senha, preencha o dado abaixo.
				</div>
			</div>



<span class="textonormal">
Nova senha</span> <br>
<input name="nova_senha" type="password"   class="text-input small-input"  id="nova_senha" value="">



<br />
<br />
Ativo: 
<input type="checkbox" name="ativo" value="1" <?php if($row['ativo'] == 1){ echo "checked='checked'"; }else{ echo ""; } ?>  id="checkbox" />
<br />

<br>
<input type="submit" class="button" value="Alterar dados">
</div>

</form>